package org.javaboy.demo.service;

import org.javaboy.demo.anno.MyTx;
import org.javaboy.demo.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

@Service
public class UserService {

    @Autowired
    UserDao userDao;

    @MyTx
    public void transferMoney(String from, String to, Double money) {
        userDao.minusMoney(from, money);
        int i = 1 / 0;
        userDao.addMoney(to, money);
    }
}
